package web

import ext.log
import manager.AsyncTask
import org.json.JSONObject
import web.handler.*

object WebAppRequestHandler {

    fun onRequest(body: String) {
        log("webapp 请求:$body")

        val json = JSONObject(body)
        val req = json.getString("request")

        when (req) {
            OnGetInvHandler.REQ -> AsyncTask.post( OnGetInvHandler(json) )
            OnPayHandler.REQ -> AsyncTask.post( OnPayHandler(json) )
            OnPayCancelHandler.REQ -> AsyncTask.post( OnPayCancelHandler(json) )
            OnDeliveryHandler.REQ -> AsyncTask.post( OnDeliveryHandler(json) )
            OnPayAndDeliveryHandler.REQ -> AsyncTask.post( OnPayAndDeliveryHandler(json) )
        }
    }

}



















